<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%
    Class.forName("oracle.jdbc.driver.OracleDriver");

    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@ora-003.cafe24.com:1521:orcl", "miru032", "my1004sd");

    String objId = request.getParameter("objId");
    String commentPw = request.getParameter("commentPw");

    StringBuilder sbQuery = new StringBuilder();
    sbQuery.append("DELETE FROM WEDDING_COMMENT WHERE OBJ_ID = ? AND COMMENT_PW = ?");

    PreparedStatement pstmt = conn.prepareStatement(sbQuery.toString());
    pstmt.setLong(1, Long.valueOf(objId));
    pstmt.setString(2, commentPw);
    int result = pstmt.executeUpdate();

    conn.close();

    if(result != 1) {
        throw new Exception("row is nothing");
    }
%>